home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMP Graphics Collection
/
AMP Graphics Collection.iso
/
programs
/
author
/
versions
/
testd4.dir
/
00002_Script_Cut-n-paste Lingo handlers
< prev
next >
Wrap
Text File
|
1996-08-09
|
6KB
|
214 lines
--Versions XObject, v. 1.1, 8/9/96
--Copyright ⌐ 1996 Glenn M. Picher, Dirigo Multimedia
--Email: gpicher@maine.com; Phone: 207/767-8015;
--Web: http://www.maine.com/shops/gpicher
--These handlers can be cut and pasted into your projects.
--You'll never have to deal with the XObject directly.
--Make sure to copy the XObject into the same folder as your movie,
--or modify the filenames in the insureVerObject() handler.
--Don't forget to copy Ask32.exe, Vers32.dll,
--Ask16.exe, and Vers16.dll there, too.
--Note that the names of these Lingo handlers will be the same
--as the names of the global handlers implemented by the eventual
--Xtra version of the Versions XObject, so you won't need to
--revise your code (other than eliminating this script,
--and commenting out the necessary XObject initialization code,
--if you had chosen to place it in your startMovie, stopMovie,
--or other handlers).
global gVerObject, gVerFileName, gOpenXLibFileName, gVoid
on openVersions
insureVerObject()
end
on closeVersions
if objectP(gVerObject) then gVerObject(mDispose)
if objectP(factory("Versions")) then
if stringP(gVerFileName) then
closexlib gVerFileName
set gVerFileName to gVoid
else
alert "Warning: can't close Versions XObject (filename unknown)."
set gVerFileName to gVoid
return
end if
if objectP(factory("Versions")) then
alert "Warning: can't close Versions XObject (instances still active?)."
end if
end if
end
on VerMDescribe
insureVerObject()
return Versions(mMessageList)
end
on quickTimeVersion
insureVerObject()
return gVerObject(mQuickTimeVersion)
end
on win32QuickTimeVersion
insureVerObject()
return gVerObject(mWin32QuickTimeVersion)
end
on fileVersion theFile
if not stringP(theFile) then
alert "fileVersion(): theFile not a string."
abort
end if
insureVerObject()
return gVerObject(mFileVersion, theFile)
end
on windowsDirectory
insureVerObject()
return gVerObject(mWindowsDirectory)
end
on win32WindowsDirectory
insureVerObject()
return gVerObject(mWin32WindowsDirectory)
end
on systemDirectory
insureVerObject()
return gVerObject(mSystemDirectory)
end
on win32systemDirectory
insureVerObject()
return gVerObject(mWin32SystemDirectory)
end
on dosVersion
insureVerObject()
return gVerObject(mDOSVersion)
end
on windowsVersion
insureVerObject()
return gVerObject(mWindowsVersion)
end
on win32Version
insureVerObject()
return gVerObject(mWin32Version)
end
on win32Platform
insureVerObject()
return gVerObject(mWin32Platform)
end
on win32Build
insureVerObject()
return gVerObject(mWin32Build)
end
on winNTVersion
insureVerObject()
return gVerObject(mWinNTVersion)
end
on getShortFileName theFile
insureVerObject()
return gVerObject(mGetShortFileName, theFile)
end
on getLongFileName theFile
insureVerObject()
return gVerObject(mGetLongFileName, theFile)
end
on insureVerObject
if not objectP(gVerObject) then
set gVerObject = getXObjectInstance("Versions", ¼
"Versions XObject", "VERSIONS.DLL") --can include full pathnames, too
set gVerFileName to gOpenXLibFileName
if not objectP(gVerObject) then
alert "Warning: global XObject instance ''gVerObject'' is invalid."
abort
end if
end if
end
on getXObjectInstance theName, theMacFile, theWinFile
set theFactory to factory(theName)
if not objectP(theFactory) then
if the machineType < 256 then
--Mac
set theFile to theMacFile
set thePlatform to "Macintosh"
else
--Win
set theFile to theWinFile
set thePlatform to "Windows"
end if
if pathOnly(theFile) = EMPTY then
set checkFile to the pathName & theFile
else
set checkFile to theFile
end if
if not fileExists(checkFile) then
set msg = "Could not locate the " & thePlatform
put " XObject file ''" & fileOnly(checkFile) & "'' in the folder ''" after msg
put pathOnly(checkFile) & "'' ." after msg
alert msg
return gVoid
end if
openxlib theFile
set gOpenXLibFileName to theFile --preserve for possible closexlib later
set theFactory to factory(theName)
if not objectP(theFactory) then
set msg = "Could not access the ''" & theName & "'' XObject in the "
put thePlatform after msg
put "XObject file ''" & fileOnly(checkFile) & "'' in the folder ''" after msg
put pathOnly(checkFile) & "'' ." after msg
alert msg
return gVoid
end if
end if
return theFactory(mNew)
end
on fileExists theFile
set thePath to pathOnly(theFile)
if thePath = EMPTY then set thePath to the pathName
set fileName to fileOnly(theFile)
repeat with i = 1 to the maxInteger
set thisFile to getNthFileNameInFolder(thePath, i)
if thisFile = EMPTY then return FALSE
if thisFile = fileName then return TRUE
end repeat
return FALSE
end
on fileOnly thePath
set oldDelim to the itemDelimiter
set the itemDelimiter to ":"
if the machineType = 256 then set the itemDelimiter to "\"
set ni to the number of items in thePath
set returnValue to item ni of thePath
set the itemDelimiter to oldDelim
return returnValue
end
on pathOnly thePath
set oldDelim to the itemDelimiter
set the itemDelimiter to ":"
if the machineType = 256 then set the itemDelimiter to "\"
set ni to the number of items in thePath
if ni = 1 then
set returnValue to ""
else
set returnValue to item 1 to (ni-1) of thePath & the itemDelimiter
end if
set the itemDelimiter to oldDelim
return returnValue
end